Skip to content

Fix Windows compilation issue in ggml-bitnet-mad#436

Open
AliMa3s wants to merge 1 commit intomicrosoft:mainfrom
AliMa3s:fix/windows-ggml-bitnet-mad
Open

Fix Windows compilation issue in ggml-bitnet-mad#436
AliMa3s wants to merge 1 commit intomicrosoft:mainfrom
AliMa3s:fix/windows-ggml-bitnet-mad

Conversation

@AliMa3s
Copy link

@AliMa3s AliMa3s commented Mar 12, 2026

This PR fixes a Windows compilation issue in src/ggml-bitnet-mad.cpp.

When building BitNet on Windows with MSVC/Clang, the code fails due to a const pointer type mismatch.
This change corrects the pointer type so the project builds successfully.

Tested locally on Windows with Python 3.12 using the setup_env.py pipeline.

@coolsumesh
Copy link

Environment

  • OS: Windows 11
  • Compiler: Clang 19 (via Visual Studio 2022 Build Tools + clang-cl)
  • CMake: 3.x

Problem

Building on Windows with ClangCL fails with the following errors:

  1. src/ggml-bitnet-mad.cpp line 811 — const pointer mismatch
    error: cannot initialize a variable of type 'int8_t *' with an rvalue of type 'const int8_t *'
    Fix: change int8_t * to const int8_t *

  2. Missing #include in 3rdparty/llama.cpp submodule

The following files use std::chrono without explicitly including . On Linux/GCC it is pulled in implicitly,
but Clang on Windows is stricter:

  • 3rdparty/llama.cpp/common/common.cpp
  • 3rdparty/llama.cpp/common/log.cpp
  • 3rdparty/llama.cpp/examples/imatrix/imatrix.cpp
  • 3rdparty/llama.cpp/examples/perplexity/perplexity.cpp

Fix: add #include to each file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants